﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FacadeSingTowerMall;
using DTOSingTowerMall;

namespace WebFormSingTowerMall
{
    public class HallBookingBaseController : System.Web.UI.Page
    {

        private Dictionary<string, string> navigator;
      

        protected string currentPage;
        

        protected EventHallBookingFacade bookingFacade;
       
        protected HallBookingViewObject bookingDetails;

        
        protected virtual void Page_Load(object sender, EventArgs e)
        {
           
            navigator = new Dictionary<string, string>();
            navigator.Add("SpecifyHall.aspx", "EventBookingDetails.aspx");
            navigator.Add("EventBookingDetails.aspx", "MemberDetails.aspx");
            navigator.Add("MemberDetails.aspx", "ConfirmBooking.aspx");
            
            navigator.Add("ConfirmBooking.aspx", "~/Default.aspx");

            bookingFacade = new EventHallBookingFacade();

            if (Session["BookingDetails"] == null)
            {
                bookingDetails = new HallBookingViewObject();
                Session["BookingDetails"] = bookingDetails;
            }
            else
                bookingDetails = (HallBookingViewObject)Session["BookingDetails"];
        }


        protected void NextPage()
        {
            Response.Redirect(navigator[currentPage]);
        }

        protected void ConfirmBooking()
        {

           bool eventbook =  bookingFacade.fBookEventHall(bookingDetails.hallId, bookingDetails.hallName,
                                         bookingDetails.eventStartDate, bookingDetails.eventEndDate, bookingDetails.totalPrice, bookingDetails.eventTitle, bookingDetails.eventDesc,
                                         bookingDetails.userName, bookingDetails.identityNo, bookingDetails.cmpnyName, bookingDetails.cmpnyAddress, 
                                         bookingDetails.imgPath);


               string script = "alert('Your Event has been sent for Approval');";
               ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
   
        }
    }
}